package cn.tedu.csmall.passport.web;

import lombok.Getter;

import javax.servlet.http.HttpServletResponse;

@Getter
public enum ServiceCode {

    OK(HttpServletResponse.SC_OK,"成功！"),//200

    ERR_UNAUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "用户名或密码不存在"),// 401

    ERR_UNAUTHORIZED_DISABLE(402, "账号被禁用"),// 402

    ERR_FORBIDDEN(HttpServletResponse.SC_FORBIDDEN, "没有权限"),// 403

    ERR_NOT_FOUND(HttpServletResponse.SC_NOT_FOUND,"数据不存在"),//404

    ERR_CONFLICT(HttpServletResponse.SC_CONFLICT,"名称被占用！"),//409

    ERR_BAD_REQUEST(HttpServletResponse.SC_BAD_REQUEST,"参数不合法！"),//400

    ERR_INSERT(500, "插入失败"),

    ERR_DELETE(501, "删除失败"),

    ERR_UPDATE(502, "更新失败"),

    ERR_JWT_EXPIRED(600, "JWT凭证过期"),

    ERR_JWT_MALFORMED(601, "JWT格式有误"),

    ERR_JWT_SIGNATURE(602, "secretKey有误"),

    ERR_UNKNOWN(99999,"服务器忙，请稍后再试！【在开发过程中，如果看到此提示，应该检查服务器端的控制台，分析异常，并在全局异常处理器中补充处理对应异常的方法】");

    private int state;
    private String message;

    ServiceCode(int state, String message) {
        this.state = state;
        this.message = message;
    }
}
